import xyRequest from '..'

// POST /upload 上传文件
export function upLoadFile(file: any) {
  return xyRequest.post({
    url: '/upload',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: file,
    timeout: 60000
  })
}

// POST /user/user/changeUserInformation 修改用户的信息
interface UserInformation {
  age?: number
  nickname?: string
  password?: string
  phoneNumber?: string
  score?: number
  skill?: string
  userBust?: string
  userEmail?: string
  userId: number
  userVita?: string
  username?: string
  sex?: string
}
export function changeUserInformation(data: UserInformation) {
  return xyRequest.post({
    url: '/user/user/changeUserInformation',
    data: data
  })
}

export function changeUserData(data: any) {
  return xyRequest.post({
    url: '/user/user/changePassword',
    headers: { 'Content-Type': 'application/json' },
    data: JSON.stringify(data)
  })
}
//GET /user/project/findBySelf 查找自己的项目
export function getMyPro() {
  return xyRequest.get({
    url: '/user/project/findBySelf'
  })
}
// GET /user/task/find/self 查找自己的任务单
export function getMyTask() {
  return xyRequest.get({
    url: '/user/task/find/self'
  })
}
// POST /user/user/findById 根据用户id获取用户信息
export function getUserInfoById(userId: string) {
  return xyRequest.post({
    url: '/user/user/findById',
    params: { userId }
  })
}
